package com.itHuangTao.tank.introduce;

import com.almasb.fxgl.app.scene.FXGLMenu;
import com.almasb.fxgl.app.scene.MenuType;
import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.texture.Texture;
import com.itHuangTao.tank.ui.HelpMenu;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;

public class Prop extends FXGLMenu {

    //存放盒子
    private static HBox propBox1, propBox2, propBox3, propBox4,
            propBox5, propBox6, propBox7, propBox8,propBox9;

    public Prop() {
        super(MenuType.GAME_MENU);

        StackPane pane = new StackPane();
        //设置窗口大小
        pane.setPrefSize(FXGL.getAppWidth(), FXGL.getAppHeight());
        //设置背景色(黑色)
        pane.setStyle("-fx-background-color: black");
        //整理道具文本介绍
        PropPrepare();
        VBox levelBox = new VBox(30, propBox1, propBox2, propBox3, propBox4,
                propBox5, propBox6, propBox7, propBox8,propBox9);
        levelBox.setLayoutX(50);
        levelBox.setLayoutY(50);

        //按钮属性
        Button btnReturnLastMenu = new Button("返回上一级");
        btnReturnLastMenu.getStyleClass().add("menu-btn");//利用css设置样式
        btnReturnLastMenu.setOnAction(event -> {
            FXGL.getSceneService().pushSubScene(new HelpMenu());
        });

        //存放按钮属性
        VBox box = new VBox(30, btnReturnLastMenu);
        box.setLayoutX(FXGL.getAppWidth() / 2.0 - 100);
        box.setLayoutY(550);

        getContentRoot().getChildren()
                .addAll(pane, levelBox, box);
    }

    //整理道具
    private static void PropPrepare() {
        //星星
        Text text1 = new Text("我方：坦克的等级加一\t\t\t敌方：所有已经产生的坦克满级");
        text1.setFont(Font.font(20));
        text1.setFill(Color.RED);
        Texture texture1 = FXGL.texture("item/star.png");
        //枪
        Text text2 = new Text("我方：坦克的等级直接满级\t\t敌方：所有已经产生的坦克满级");
        text2.setFont(Font.font(20));
        text2.setFill(Color.RED);
        Texture texture2 = FXGL.texture("item/gun.png");
        //爱心
        Text text3 = new Text("我方：玩家的生命值加满\t\t\t敌方：控制玩家生命值减半");
        text3.setFont(Font.font(20));
        text3.setFill(Color.RED);
        Texture texture3 = FXGL.texture("item/heart.png");
        //炸弹
        Text text4 = new Text("我方：使得敌方坦克全部爆炸\t\t敌方：使得玩家只剩下一滴血");
        text4.setFont(Font.font(20));
        text4.setFill(Color.RED);
        Texture texture4 = FXGL.texture("item/bomb.png");
        //轮船
        Text text5 = new Text("我方：可以坦克在水面上行走\t\t敌方：所有已经产生的坦克获得轮船效果");
        text5.setFont(Font.font(20));
        text5.setFill(Color.RED);
        Texture texture5 = FXGL.texture("item/ship.png");
        //时间
        Text text6 = new Text("我方：敌方坦克静止5秒钟\t\t\t敌方：使得我方坦克不能移动2秒钟");
        text6.setFont(Font.font(20));
        text6.setFill(Color.RED);
        Texture texture6 = FXGL.texture("item/time.png");
        //钢盔
        Text text7 = new Text("我方：玩家无敌10秒\t\t\t\t敌方：可以使得敌方坦克无敌10秒");
        text7.setFont(Font.font(20));
        text7.setFill(Color.RED);
        Texture texture7 = FXGL.texture("item/helmet.png");
        //铲子
        Text text8 = new Text("我方：可以升级保护墙维持15秒\t\t敌方：可以清空我方基地的保护墙");
        text8.setFont(Font.font(20));
        text8.setFill(Color.RED);
        Texture texture8 = FXGL.texture("item/spade.png");
        //坦克
        Text text9 = new Text("我方：增加我方一格血量\t\t\t敌方：减少我方一格血量");
        text9.setFont(Font.font(20));
        text9.setFill(Color.RED);
        Texture texture9 = FXGL.texture("item/tank.png");

        //放入盒子当中
        propBox1 = new HBox(texture1, text1);
        propBox2 = new HBox(texture2, text2);
        propBox3 = new HBox(texture3, text3);
        propBox4 = new HBox(texture4, text4);
        propBox5 = new HBox(texture5, text5);
        propBox6 = new HBox(texture6, text6);
        propBox7 = new HBox(texture7, text7);
        propBox8 = new HBox(texture8, text8);
        propBox9 = new HBox(texture9, text9);
    }
}
